<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title></title>
	<style>
		.uploadImgBtn {

			width: 100px;
			height: 100px;
			cursor: pointer;
			position: relative;
			/*background: url("img/plus.png") no-repeat;*/
			background-color: red;
			-webkit-background-size: cover;
			background-size: cover;
		}

		.uploadImgBtn .uploadImg {
			position: absolute;
			right: 0;
			top:0;
			width: 100%;
			height: 100%;
			opacity: 0;
			cursor: pointer;
		}
		  .pic{
			  width: 100px;
			  height: 100px;
		  }
		.pic img {
			width: 100%;
			height: 100%;
		}
	</style>
</head>
<body>
	<div class="layui-tab-content">
		<div class="layui-tab-item layui-show">
			<form id="uploadForm"  enctype="multipart/form-data" method="post">
				文件:<input type="file" name="files" id="inp" multiple="multiple"/><br>
				用户ID：<input type="text" name="uid" value="" id="uid"/>
				<input type="hidden" name="fileId" value="" readonly>
			</form>
			<button id="upload">上传文件</button>
		</div>
	</div>
</body>
</html>
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<script type="text/javascript">
//请求路径      http://zhongbao.com/index/Feedback/uploadImgs

$("#upload").click(function () {
//	var formData = new FormData($('#uploadForm'));
	var formData = new FormData();
	var filec = $("#inp").files;
//	var uid = $("[name = 'uid']").val();
//	if (!uid) {
//		alert('您还未登陆，请先登陆');
//		return;
//	}
//	formData.append("uid", uid);
	$.ajax({
		type: 'post',
		url: "http://zhongbao.com/index/Feedback/uploadImgs",
		data: formData,
		dataType:'json',
		cache: false,
		processData: false,
		contentType: false,
		success:function(data){
			alert(1233);
		},
		error:function(error){
			alert("上传失败");
			console.log(JSON.stringify(error))
		}
	})
});
</script>



